package com.yunupmall.mapper.FordMapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunupmall.api.fordentity.Shoping;
import com.yunupmall.entity.ford.FordShopingMupData;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface ShopingMapper extends BaseMapper<Shoping> {
    @Insert("insert into shoping(sp_id,counts,m_id)values(#{s_id},#{counts},#{m_id})")
    int insertShoppingData(@Param("s_id") Integer id, @Param("counts") Integer counts, @Param("m_id") Integer m_id);

    //查询购物车信息
    @Select("SELECT c.example_image1,c.name,c.id as cId,sp.id as spId,sp.prices,sp.c_sku,s.counts ,s.id as shopingId from  shoping s LEFT JOIN specs_commodity sp on s.sp_id=sp.id LEFT JOIN commodity c on sp.c_id=c.id where s.m_id=#{mId} and s.deflag=0")
    List<FordShopingMupData> queryshopData(@Param("mId") Integer mId);


}
